namespace Web.Control.WWW.Feedback
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;
    using System.IO;
    using Lx.Web.Common.ControlsUI;
    using Lx.Web.Common.UI;
    using System.Xml;
    using System.Xml.Schema;

    using BLF.WWW_WWW.Feedback;
    using BLF.WWW_User.Users;
    using Model.WWW_User.User;


    public class Default : BaseControl
    {
        protected string Membername;
        protected string obum;
        protected string CurCate;
        protected UserModel um;
        protected string UrlRefer = "";
        protected string ToLng = "en-us";
        protected override void OnLoad(EventArgs e)
        {
            if (HttpContext.Current.User.Identity.Name != "")
            {
            
                Membername = HttpContext.Current.User.Identity.Name;
               
                obum = User.GetUserEmail(Membername);
            
            }
            else if (this.ViewState["BaseLanguage"] != null)
            {
                if (this.ViewState["BaseLanguage"].ToString().Trim() != "") ToLng = this.ViewState["BaseLanguage"].ToString().Trim();
            }

            if (!Page.IsPostBack)
            {
                UrlRefer = HttpContext.Current.Request.UrlReferrer == null ? "" : HttpContext.Current.Request.UrlReferrer.AbsoluteUri;
                ViewState["urlRefer"] = UrlRefer;

                if (Request["CateID"] != null)
                {
                   
                     CurCate = Request["CateID"].ToString();
                }
                if (Request["MemberNo"] != null)
                {
                    um = User.GetDetailUserInfo(HttpContext.Current.User.Identity.Name);
                }
                else
                {
                    um = null;
                }
            }
            
            
              Response.Write("<script>var MemberNo='" + HttpContext.Current.User.Identity.Name + "'</script>");
        }
       
        public string GetFeedBackCatSelect(string selectValue)
        {
            DataTable dt = GetDTFromXml("FeedBackCat.xml");
            return RendOption(dt, selectValue);
        }
        
        private string RendOption(DataTable dt, string selectValue)
        {
            string p = "";
            foreach (DataRow dr in dt.Rows)
            {
                if (dr[0].ToString().ToLower() == selectValue.ToLower() && selectValue != "")
                {
                    p += string.Format("<option value='{0}' selected>{1}</option>", dr[0].ToString(), dr[1].ToString());
                }
                else
                {
                    p += string.Format("<option value='{0}'>{1}</option>", dr[0].ToString(), dr[1].ToString());
                }
            }
            return p;
        }

    }
}




























